import asyncRoutes from '@/router/asyncRoutes'
import { constantRoutes } from '@/router'
const state = {
    routes: constantRoutes
}
const mutations = {
    SET_ROUTES(state, val) {
        state.routes = [...constantRoutes, ...val]
    }
}
const actions = {
    filterRoute({ commit }, list) {
        let routes = []
        list.forEach(element => {
            routes.push(...asyncRoutes.filter(item => {
                return item.name == element
            }))
        })
        commit('SET_ROUTES', routes)
        return routes
    }
}

export default {
    namespaced: true,
    state, mutations, actions
}